﻿using System;
using System.Collections.Generic;
using UFrameWork;

namespace ExampleServer
{
    //继承Ucontroller启动器自动加载并实例化
    public class TestController : UController
    {
        //框架启动完成,框架事件参考UEvent定义
        [UControllerAction(UEvent.INIT_FINISH)]
        public static void Init()
        {
            Console.Title = "测试服务器";
            UServer server = new UServer(2016);
        }

        //Hello测试
        [UControllerAction("msg.test.hello")]
        public void TestHello(USession session,string data)
        {
            Console.WriteLine(data);
            session.Send("msg.test.hello.resp", "Hello Client!!!");
        }

        //排行榜测试
        [UControllerAction("msg.test.rank")]
        public void TestRank(USession session)
        {
            session.Send("msg.test.rank.resp", 10, new List<string>() { "rank1", "rank2", "rank3", "rank4" });
        }
    }
}